import gurobi_LPrelaxed
import gurobi_opt
import ALG_3_1

s0 = "graph"
s1 = "graph_out"
for num in range(0, 10):
    outfilename = s1 + "\\%d_out.txt"%num
    solans = 0.0
    gapans = 0.0
    solgapans = 0.0
    for rep in range(0, 10):
        infilename = s0 + "\\%d\\%d"%(num, rep) + ".txt"
        opt = gurobi_opt.MainFunction(infilename)
        sol = ALG_3_1.MainFunction(infilename)
        LPr = gurobi_LPrelaxed.MainFunction(infilename)
        solans += sol/opt
        solgapans += sol/LPr
        gapans += LPr/opt
    solans/=10.0
    solgapans/=10.0
    gapans/=10.0
    fout = open(outfilename,"w")
    fout.write("Ave: %f\n"%solans)
    fout.write("AveRelaxGap: %f\n"%gapans)
    fout.write("AveRelaxMaxGap: %f\n"%solgapans)
    fout.close()
    

